3.1.9 \(\int \frac {\cos ^3(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\) [9]

Optimal. Leaf size=76 \[ \frac {\left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 c^2}-\frac {\sin (x)}{c} \]

[Out]

1/2*b*ln(a+b*sin(x)+c*sin(x)^2)/c^2-sin(x)/c+(b^2-2*c*(a+c))*arctanh((b+2*c*sin(x))/(-4*a*c+b^2)^(1/2))/c^2/(-
4*a*c+b^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3339, 1671, 648, 632, 212, 642} \begin {gather*} \frac {\left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 c^2}-\frac {\sin (x)}{c} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[x]^3/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

((b^2 - 2*c*(a + c))*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]])/(c^2*Sqrt[b^2 - 4*a*c]) + (b*Log[a + b*Sin[x
] + c*Sin[x]^2])/(2*c^2) - Sin[x]/c

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 1671

Int[(Pq_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x + c*x^2)^p, x
], x] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 3339

Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.
) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Dist[g/e, Subst[Int[(1
 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e*x]/g], x]] /; FreeQ[{a, b, c,
d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \frac {\cos ^3(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx &=\text {Subst}\left (\int \frac {1-x^2}{a+b x+c x^2} \, dx,x,\sin (x)\right )\\ &=\text {Subst}\left (\int \left (-\frac {1}{c}+\frac {a+c+b x}{c \left (a+b x+c x^2\right )}\right ) \, dx,x,\sin (x)\right )\\ &=-\frac {\sin (x)}{c}+\frac {\text {Subst}\left (\int \frac {a+c+b x}{a+b x+c x^2} \, dx,x,\sin (x)\right )}{c}\\ &=-\frac {\sin (x)}{c}+\frac {b \text {Subst}\left (\int \frac {b+2 c x}{a+b x+c x^2} \, dx,x,\sin (x)\right )}{2 c^2}-\frac {\left (b^2-2 c (a+c)\right ) \text {Subst}\left (\int \frac {1}{a+b x+c x^2} \, dx,x,\sin (x)\right )}{2 c^2}\\ &=\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 c^2}-\frac {\sin (x)}{c}+\frac {\left (b^2-2 c (a+c)\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c \sin (x)\right )}{c^2}\\ &=\frac {\left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 c^2}-\frac {\sin (x)}{c}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 73, normalized size = 0.96 \begin {gather*} \frac {\frac {2 \left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}}+b \log \left (a+b \sin (x)+c \sin ^2(x)\right )-2 c \sin (x)}{2 c^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]^3/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

((2*(b^2 - 2*c*(a + c))*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]])/Sqrt[b^2 - 4*a*c] + b*Log[a + b*Sin[x] +
c*Sin[x]^2] - 2*c*Sin[x])/(2*c^2)

________________________________________________________________________________________

Maple [A]
time = 0.50, size = 79, normalized size = 1.04

method result size
default \(-\frac {\sin \left (x \right )}{c}+\frac {\frac {b \ln \left (a +b \sin \left (x \right )+c \left (\sin ^{2}\left (x \right )\right )\right )}{2 c}+\frac {2 \left (a +c -\frac {b^{2}}{2 c}\right ) \arctan \left (\frac {b +2 c \sin \left (x \right )}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{c}\) \(79\)
risch \(\frac {i b x}{c^{2}}+\frac {i {\mathrm e}^{i x}}{2 c}-\frac {i {\mathrm e}^{-i x}}{2 c}-\frac {8 i x a b c}{4 a \,c^{3}-b^{2} c^{2}}+\frac {2 i x \,b^{3}}{4 a \,c^{3}-b^{2} c^{2}}+\frac {2 \ln \left ({\mathrm e}^{2 i x}+\frac {i \left (2 a b c -b^{3}+2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) a b}{\left (4 a c -b^{2}\right ) c}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i \left (2 a b c -b^{3}+2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) b^{3}}{2 \left (4 a c -b^{2}\right ) c^{2}}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i \left (2 a b c -b^{3}+2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) \sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}}{2 \left (4 a c -b^{2}\right ) c^{2}}+\frac {2 \ln \left ({\mathrm e}^{2 i x}-\frac {i \left (-2 a b c +b^{3}-2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) a b}{\left (4 a c -b^{2}\right ) c}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i \left (-2 a b c +b^{3}-2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) b^{3}}{2 \left (4 a c -b^{2}\right ) c^{2}}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i \left (-2 a b c +b^{3}-2 b \,c^{2}+\sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}-1\right ) \sqrt {-16 a^{3} c^{3}+20 a^{2} b^{2} c^{2}-32 a^{2} c^{4}-8 a \,b^{4} c +24 a \,b^{2} c^{3}-16 a \,c^{5}+b^{6}-4 b^{4} c^{2}+4 b^{2} c^{4}}}{2 \left (4 a c -b^{2}\right ) c^{2}}\) \(1072\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^3/(a+b*sin(x)+c*sin(x)^2),x,method=_RETURNVERBOSE)

[Out]

-sin(x)/c+1/c*(1/2*b/c*ln(a+b*sin(x)+c*sin(x)^2)+2*(a+c-1/2*b^2/c)/(4*a*c-b^2)^(1/2)*arctan((b+2*c*sin(x))/(4*
a*c-b^2)^(1/2)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^3/(a+b*sin(x)+c*sin(x)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

________________________________________________________________________________________

Fricas [A]
time = 0.45, size = 276, normalized size = 3.63 \begin {gather*} \left [-\frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {b^{2} - 4 \, a c} \log \left (-\frac {2 \, c^{2} \cos \left (x\right )^{2} - 2 \, b c \sin \left (x\right ) - b^{2} + 2 \, a c - 2 \, c^{2} + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} - b \sin \left (x\right ) - a - c}\right ) - {\left (b^{3} - 4 \, a b c\right )} \log \left (-c \cos \left (x\right )^{2} + b \sin \left (x\right ) + a + c\right ) + 2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} \sin \left (x\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}, \frac {2 \, {\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right ) + {\left (b^{3} - 4 \, a b c\right )} \log \left (-c \cos \left (x\right )^{2} + b \sin \left (x\right ) + a + c\right ) - 2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} \sin \left (x\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^3/(a+b*sin(x)+c*sin(x)^2),x, algorithm="fricas")

[Out]

[-1/2*((b^2 - 2*a*c - 2*c^2)*sqrt(b^2 - 4*a*c)*log(-(2*c^2*cos(x)^2 - 2*b*c*sin(x) - b^2 + 2*a*c - 2*c^2 + sqr
t(b^2 - 4*a*c)*(2*c*sin(x) + b))/(c*cos(x)^2 - b*sin(x) - a - c)) - (b^3 - 4*a*b*c)*log(-c*cos(x)^2 + b*sin(x)
 + a + c) + 2*(b^2*c - 4*a*c^2)*sin(x))/(b^2*c^2 - 4*a*c^3), 1/2*(2*(b^2 - 2*a*c - 2*c^2)*sqrt(-b^2 + 4*a*c)*a
rctan(-sqrt(-b^2 + 4*a*c)*(2*c*sin(x) + b)/(b^2 - 4*a*c)) + (b^3 - 4*a*b*c)*log(-c*cos(x)^2 + b*sin(x) + a + c
) - 2*(b^2*c - 4*a*c^2)*sin(x))/(b^2*c^2 - 4*a*c^3)]

________________________________________________________________________________________

Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)**3/(a+b*sin(x)+c*sin(x)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]
time = 0.59, size = 78, normalized size = 1.03 \begin {gather*} \frac {b \log \left (c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a\right )}{2 \, c^{2}} - \frac {\sin \left (x\right )}{c} - \frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \arctan \left (\frac {2 \, c \sin \left (x\right ) + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^3/(a+b*sin(x)+c*sin(x)^2),x, algorithm="giac")

[Out]

1/2*b*log(c*sin(x)^2 + b*sin(x) + a)/c^2 - sin(x)/c - (b^2 - 2*a*c - 2*c^2)*arctan((2*c*sin(x) + b)/sqrt(-b^2
+ 4*a*c))/(sqrt(-b^2 + 4*a*c)*c^2)

________________________________________________________________________________________

Mupad [B]
time = 0.21, size = 229, normalized size = 3.01 \begin {gather*} \frac {2\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,\sin \left (x\right )}{\sqrt {4\,a\,c-b^2}}\right )}{\sqrt {4\,a\,c-b^2}}-\frac {\sin \left (x\right )}{c}-\frac {b^3\,\ln \left (c\,{\sin \left (x\right )}^2+b\,\sin \left (x\right )+a\right )}{2\,\left (4\,a\,c^3-b^2\,c^2\right )}-\frac {b^2\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,\sin \left (x\right )}{\sqrt {4\,a\,c-b^2}}\right )}{c^2\,\sqrt {4\,a\,c-b^2}}+\frac {2\,a\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,\sin \left (x\right )}{\sqrt {4\,a\,c-b^2}}\right )}{c\,\sqrt {4\,a\,c-b^2}}+\frac {2\,a\,b\,c\,\ln \left (c\,{\sin \left (x\right )}^2+b\,\sin \left (x\right )+a\right )}{4\,a\,c^3-b^2\,c^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^3/(a + c*sin(x)^2 + b*sin(x)),x)

[Out]

(2*atan(b/(4*a*c - b^2)^(1/2) + (2*c*sin(x))/(4*a*c - b^2)^(1/2)))/(4*a*c - b^2)^(1/2) - sin(x)/c - (b^3*log(a
 + c*sin(x)^2 + b*sin(x)))/(2*(4*a*c^3 - b^2*c^2)) - (b^2*atan(b/(4*a*c - b^2)^(1/2) + (2*c*sin(x))/(4*a*c - b
^2)^(1/2)))/(c^2*(4*a*c - b^2)^(1/2)) + (2*a*atan(b/(4*a*c - b^2)^(1/2) + (2*c*sin(x))/(4*a*c - b^2)^(1/2)))/(
c*(4*a*c - b^2)^(1/2)) + (2*a*b*c*log(a + c*sin(x)^2 + b*sin(x)))/(4*a*c^3 - b^2*c^2)

________________________________________________________________________________________